package com.diaosidadui.array;

import java.util.Scanner;

public class Test04 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int length = sc.nextInt();
        sum(length);

    }
//求n个整数的和
    public static int sum(int n) {

            Scanner sc = new Scanner(System.in);
        int[] arr = new int[n];
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            //arr[i]
            System.out.println("请输入第" + (i + 1) + "个数字:");
            arr[i] = sc.nextInt();
            sum += arr[i];
        }

        System.out.println("和是" + sum);
    return sum;
    }
}
